## Calculations reported about page 157:

library(descr)

sponsor <- read.table("data/sponsor.txt", header = TRUE, sep = "\t")
big <- merge(adat, sponsor, by = "mcid2")
table(big$factory.s1, big$sponsor, dnn = c("Factory", "Sponsor"))
sponsor.dummy <- ifelse(big$sponsor>0, "1", "0")
sponsor.dummy <- as.character(sponsor.dummy)
sponsor.dummy <- as.numeric(sponsor.dummy)
table(big$factory.s1, sponsor.dummy, dnn = c("Factory", "Sponsor"))

### Money Variables: Total.AFL.CIO, Total.FordDCGM, 
money.dummybig3 <- ifelse(big$Total.FordDCGM >0, "1", "0")
money.dummybig3 <- as.character(money.dummybig3)
money.dummybig3 <- as.numeric(money.dummybig3)
dummydat<-as.data.frame(cbind(sponsor.dummy, money.dummybig3, big$factory.s1, big$factory.s2))

big$dummy.factory <- 0
big$dummy.factory[big$factory.s1 > 0] <- 1
big$dummy.factory[big$factory.s2 > 0] <- 1
dummy.factory <- big$dummy.factory

table(money.dummybig3,sponsor.dummy, dnn=c("Big 3 Money", "Sponsor"))
crosstab(money.dummybig3, sponsor.dummy, ylab="Sponsor", xlab="Money", prop.r = T,chisq = TRUE)
crosstab(dummy.factory, sponsor.dummy, ylab="Sponsor", xlab="Factory", prop.r = T,chisq = TRUE)
